package com.sky.controller.admin;

import com.sky.result.Result;
import com.sky.service.ShopService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Api(tags = "商城模块")
@Slf4j
@RestController
@RequestMapping("/admin/shop")
public class ShopController {

    @Autowired
    private ShopService shopService;

    @PutMapping("/{status}")
    @ApiOperation("设置营业状态")
    public Result setShopStatus(@PathVariable("status") Integer status) {
        //0打样，1营业
        log.info("营业状态：", status==1? "营业" : "打样");
        shopService.setShopStatus(status);
        return Result.success();
    }
    @ApiOperation("获取营业状态")
    @GetMapping("/status")
    public Result<Integer> getShopStatus() {
        Integer status = shopService.getShopStatus();
        return Result.success(status);
    }
}
